/**
 * Created by DevilsEyes on 2016/4/22.
 */
//studentList
define(['md5'], function (md5) {
    'use strict';

    var vm = avalon.define({
        $id: 'login',
        id: '',
        password: '',
        login: function (e) {
            e.preventDefault();
            $.ajax({
                url: '/api/admin/user/login',
                method: 'POST',
                data: {
                    sid: md5(vm.id),
                    password: md5(vm.password)
                },
                success: function (data) {
                    if (data.user) {
                        $root.login = true;
                        location.hash = '/student/list';
                    }
                }
            })
        }
    });

    return {
        init: function () {
            // vm.list = [];
            // vm.getList();
            // $root.page = temp;
        }
    }
});
